<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="keywords" content="Open API,指南" />
	<meta name="description" content="Open API 指南" />
	<!-- 网页标签标题 -->
	<title>Open API 指南</title>
	<link rel="shortcut icon" href="https://img.alicdn.com/tfs/TB1hgJpHAPoK1RjSZKbXXX1IXXa-64-64.png"/>
	<link rel="stylesheet" href="/build/documentation.css" />
</head>
<body>
	<div id="root"><div class="documentation-page" data-reactroot=""><header class="header-container header-container-normal"><div class="header-body"><a href="/zh-cn/index.html"><img class="logo" src="/img/nacos_colorful.png"/></a><div class="search search-normal"><span class="icon-search"></span></div><span class="language-switch language-switch-normal">En</span><div class="header-menu"><img class="header-menu-toggle" src="/img/menu_gray.png"/><ul><li class="menu-item menu-item-normal"><a href="/zh-cn/index.html">首页</a></li><li class="menu-item menu-item-normal menu-item-normal-active"><a href="/zh-cn/docs/what-is-nacos.html">文档</a></li><li class="menu-item menu-item-normal"><a href="/zh-cn/blog/index.html">博客</a></li><li class="menu-item menu-item-normal"><a href="/zh-cn/community/index.html">社区</a></li><li class="menu-item menu-item-normal"><a href="https://cn.aliyun.com/product/aliware/mse?spm=nacos-website.topbar.0.0.0">企业版Nacos</a><img class="menu-img" src="https://img.alicdn.com/tfs/TB1esl_m.T1gK0jSZFrXXcNCXXa-200-200.png"/></li><li class="menu-item menu-item-normal"><a href="http://console.nacos.io/nacos/index.html">控制台样例</a></li></ul></div></div></header><div class="bar"><div class="bar-body"><img src="/img/docs.png" class="front-img"/><div class="bar-title"><span>Nacos 文档</span><div class="bone bone-light"></div></div><img src="/img/docs.png" class="back-img"/></div></div><section class="content-section"><div class="content-body"><div class="sidemenu"><div class="sidemenu-toggle"><img src="https://img.alicdn.com/tfs/TB1E6apXHGYBuNjy0FoXXciBFXa-200-200.png"/></div><ul><li class="menu-item menu-item-level-1"><span>Nacos </span><ul><li style="height:180px;overflow:hidden" class="menu-item menu-item-level-2"><span>Nacos是什么?<img style="transform:rotate(0deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/what-is-nacos.html" target="_self">Nacos简介</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/concepts.html" target="_self">概念</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/architecture.html" target="_self">架构</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/feature-list.html" target="_self">功能和需求列表</a></li></ul></li><li style="height:324px;overflow:hidden" class="menu-item menu-item-level-2"><span>快速开始<img style="transform:rotate(0deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/quick-start.html" target="_self">Nacos</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/quick-start-spring.html" target="_self">Nacos Spring</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/quick-start-spring-boot.html" target="_self">Nacos Spring Boot</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/quick-start-spring-cloud.html" target="_self">Nacos Spring Cloud</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/quick-start-docker.html" target="_self">Nacos Docker</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/use-nacos-with-dubbo.html" target="_self">Nacos Dubbo</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/use-nacos-with-kubernetes.html" target="_self">Nacos k8s</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/nacos-sync.html" target="_self">Nacos Sync</a></li></ul></li><li style="height:252px;overflow:hidden" class="menu-item menu-item-level-2"><span>用户指南<img style="transform:rotate(0deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/sdk.html" target="_self">Java的SDK</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/other-language.html" target="_self">其他语言的SDK</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/open-api.html" target="_self">Open-API指南</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/nacos-spring.html" target="_self">Nacos Spring</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/system-configurations.html" target="_self">Nacos系统参数介绍</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/faq.html" target="_self">FAQ</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>运维指南<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/deployment.html" target="_self">部署手册</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/cluster-mode-quick-start.html" target="_self">集群部署说明</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/management-api.html" target="_self">运维API</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/console-guide.html" target="_self">控制台手册</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/monitor-guide.html" target="_self">监控手册</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/nacos-config-benchmark.html" target="_self">服务配置模块压测报告</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/nacos-naming-benchmark.html" target="_self">服务发现模块压测报告</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/nacos-sync-use.html" target="_self">其他环境迁移到Nacos</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>开源共建<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/contributing.html" target="_self">贡献源码</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/contributing-flow.html" target="_self">贡献流程</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/pull-request.html" target="_self">pull request模板</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/how-to-reporting-bugs.html" target="_self">如何提交问题报告</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>社区<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/community.html" target="_self">社区</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/nacos-dev.html" target="_self">开发团队</a></li></ul></li></ul></li></ul></div><div class="doc-content markdown-body"><h1>Open API 指南</h1>
<ul>
<li>
<p>配置管理</p>
<ul>
<li><a href="#1.1">获取配置</a></li>
<li><a href="#1.2">监听配置</a></li>
<li><a href="#1.3">发布配置</a></li>
<li><a href="#1.4">删除配置</a></li>
</ul>
</li>
<li>
<p>服务发现</p>
<ul>
<li><a href="#2.1">注册实例</a></li>
<li><a href="#2.2">注销实例</a></li>
<li><a href="#2.3">修改实例</a></li>
<li><a href="#2.4">查询实例列表</a></li>
<li><a href="#2.5">查询实例详情</a></li>
<li><a href="#2.6">发送实例心跳</a></li>
<li><a href="#2.7">创建服务</a></li>
<li><a href="#2.8">删除服务</a></li>
<li><a href="#2.9">修改服务</a></li>
<li><a href="#2.10">查询服务</a></li>
<li><a href="#2.11">查询服务列表</a></li>
<li><a href="#2.12">查询系统开关</a></li>
<li><a href="#2.13">修改系统开关</a></li>
<li><a href="#2.14">查看系统当前数据指标</a></li>
<li><a href="#2.15">查看当前集群Server列表</a></li>
<li><a href="#2.16">查看当前集群leader</a></li>
<li><a href="#2.17">更新实例的健康状态</a></li>
<li><a href="#2.18">批量更新实例元数据(Beta)</a></li>
<li><a href="#2.19">批量删除实例元数据(Beta)</a></li>
</ul>
</li>
</ul>
<h2>配置管理</h2>
<h2 id="1.1">获取配置</h2>
<h3>描述</h3>
<p>获取Nacos上的配置。</p>
<h3>请求类型</h3>
<p>GET</p>
<h3>请求URL</h3>
<p>/nacos/v1/cs/configs</p>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必须</th>
<th style="text-align:left">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">tenant</td>
<td style="text-align:left">string</td>
<td style="text-align:left">否</td>
<td style="text-align:left">租户信息，对应 Nacos 的命名空间ID字段。</td>
</tr>
<tr>
<td style="text-align:left">dataId</td>
<td style="text-align:left">string</td>
<td style="text-align:left">是</td>
<td style="text-align:left">配置 ID。</td>
</tr>
<tr>
<td style="text-align:left">group</td>
<td style="text-align:left">string</td>
<td style="text-align:left">是</td>
<td style="text-align:left">配置分组。</td>
</tr>
</tbody>
</table>
<h3>返回参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">参数类型</th>
<th style="text-align:left">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">string</td>
<td style="text-align:left">配置值</td>
</tr>
</tbody>
</table>
<h3>错误编码</h3>
<table>
<thead>
<tr>
<th style="text-align:left">错误代码</th>
<th style="text-align:left">描述</th>
<th style="text-align:left">语义</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">400</td>
<td style="text-align:left">Bad Request</td>
<td style="text-align:left">客户端请求中的语法错误</td>
</tr>
<tr>
<td style="text-align:left">403</td>
<td style="text-align:left">Forbidden</td>
<td style="text-align:left">没有权限</td>
</tr>
<tr>
<td style="text-align:left">404</td>
<td style="text-align:left">Not Found</td>
<td style="text-align:left">无法找到资源</td>
</tr>
<tr>
<td style="text-align:left">500</td>
<td style="text-align:left">Internal Server Error</td>
<td style="text-align:left">服务器内部错误</td>
</tr>
<tr>
<td style="text-align:left">200</td>
<td style="text-align:left">OK</td>
<td style="text-align:left">正常</td>
</tr>
</tbody>
</table>
<h3>示例</h3>
<ul>
<li>
<p>请求示例</p>
<pre><code class="language-plain">http:serverIp:8848/nacos/v1/cs/configs?dataId=dataIdparam&amp;group=groupParam&amp;tenant=tenantParam

</code></pre>
</li>
<li>
<p>返回示例</p>
<pre><code>contentTest
</code></pre>
</li>
</ul>
<h2 id="1.2">监听配置</h2>
<h3>描述</h3>
<p>监听 Nacos 上的配置，以便实时感知配置变更。如果配置变更，则用<a href="~~64131~~">获取配置</a>接口获取配置的最新值，动态刷新本地缓存。</p>
<p>注册监听采用的是异步 Servlet 技术。注册监听本质就是带着配置和配置值的 MD5 值和后台对比。如果 MD5 值不一致，就立即返回不一致的配置。如果值一致，就等待住 30 秒。返回值为空。</p>
<h3>请求类型</h3>
<p>POST</p>
<h3>请求URL</h3>
<p>/nacos/v1/cs/configs/listener</p>
<h3>请求参数</h3>
<div class="bi-table">
  <table>
    <colgroup>
      <col width="auto" />
      <col width="118px" />
      <col width="115px" />
      <col width="325px" />
    </colgroup>
    <tbody>
      <tr>
        <td rowspan="1" colSpan="1">
          <div data-type="p">名称</div>
        </td>
        <td rowspan="1" colSpan="1">
          <div data-type="p">类型</div>
        </td>
        <td rowspan="1" colSpan="1">
          <div data-type="p">是否必须</div>
        </td>
        <td rowspan="1" colSpan="1">
          <div data-type="p">描述</div>
        </td>
      </tr>
      <tr>
        <td rowspan="1" colSpan="1">
          <div data-type="p">Listening-Configs</div>
        </td>
        <td rowspan="1" colSpan="1">
          <div data-type="p">string</div>
        </td>
        <td rowspan="1" colSpan="1">
          <div data-type="p">是</div>
        </td>
        <td rowspan="1" colSpan="1">
          <div data-type="p">监听数据报文。格式为 dataId^2Group^2contentMD5^2tenant^1或者dataId^2Group^2contentMD5^1。</div>
          <ul data-type="unordered-list">
            <li data-type="list-item" data-list-type="unordered-list">
              <div data-type="p">dataId：配置 ID</div>
            </li>
            <li data-type="list-item" data-list-type="unordered-list">
              <div data-type="p">group：配置分组</div>
            </li>
            <li data-type="list-item" data-list-type="unordered-list">
              <div data-type="p">contentMD5：配置内容 MD5 值</div>
            </li>
            <li data-type="list-item" data-list-type="unordered-list">
              <div data-type="p">tenant：租户信息，对应 Nacos 的命名空间字段(非必填)</div>
            </li>
          </ul>
        </td>
      </tr>
    </tbody>
  </table>
</div>
<h3>Header 参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必须</th>
<th style="text-align:left">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">Long-Pulling-Timeout</td>
<td style="text-align:left">string</td>
<td style="text-align:left">是</td>
<td style="text-align:left">长轮训等待 30s，此处填写 30000。</td>
</tr>
</tbody>
</table>
<h3>参数说明</h3>
<ul>
<li>配置多个字段间分隔符：^2  = Character.toString((char) 2</li>
<li>配置间分隔符：^1 = Character.toString((char) 1)</li>
<li>contentMD5:  MD5(content)，第一次本地缓存为空，所以这块为空串</li>
</ul>
<h3>返回参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">参数类型</th>
<th style="text-align:left">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">string</td>
<td style="text-align:left">配置值</td>
</tr>
</tbody>
</table>
<h3>错误编码</h3>
<table>
<thead>
<tr>
<th style="text-align:left">错误代码</th>
<th style="text-align:left">描述</th>
<th style="text-align:left">语义</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">400</td>
<td style="text-align:left">Bad Request</td>
<td style="text-align:left">客户端请求中的语法错误</td>
</tr>
<tr>
<td style="text-align:left">403</td>
<td style="text-align:left">Forbidden</td>
<td style="text-align:left">没有权限</td>
</tr>
<tr>
<td style="text-align:left">404</td>
<td style="text-align:left">Not Found</td>
<td style="text-align:left">无法找到资源</td>
</tr>
<tr>
<td style="text-align:left">500</td>
<td style="text-align:left">Internal Server Error</td>
<td style="text-align:left">服务器内部错误</td>
</tr>
<tr>
<td style="text-align:left">200</td>
<td style="text-align:left">OK</td>
<td style="text-align:left">正常</td>
</tr>
</tbody>
</table>
<h3>示例</h3>
<ul>
<li>请求示例</li>
</ul>
<pre><code>http://serverIp:8848/nacos/v1/cs/configs/listener

POST 请求体数据内容：

Listening-Configs=dataId^2group^2contentMD5^2tenant^1
</code></pre>
<ul>
<li>返回示例</li>
</ul>
<pre><code>如果配置变化

dataId^2group^2tenant^1

如果配置无变化：会返回空串
</code></pre>
<h2 id="1.3">发布配置</h2>
<h3>描述</h3>
<p>发布 Nacos 上的配置。</p>
<h3>请求类型</h3>
<p>POST</p>
<h3>请求 URL</h3>
<p>/nacos/v1/cs/configs</p>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必须</th>
<th style="text-align:left">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">tenant</td>
<td style="text-align:left">string</td>
<td style="text-align:left">否</td>
<td style="text-align:left">租户信息，对应 Nacos 的命名空间ID字段</td>
</tr>
<tr>
<td style="text-align:left">dataId</td>
<td style="text-align:left">string</td>
<td style="text-align:left">是</td>
<td style="text-align:left">配置 ID</td>
</tr>
<tr>
<td style="text-align:left">group</td>
<td style="text-align:left">string</td>
<td style="text-align:left">是</td>
<td style="text-align:left">配置分组</td>
</tr>
<tr>
<td style="text-align:left">content</td>
<td style="text-align:left">string</td>
<td style="text-align:left">是</td>
<td style="text-align:left">配置内容</td>
</tr>
<tr>
<td style="text-align:left">type</td>
<td style="text-align:left">String</td>
<td style="text-align:left">否</td>
<td style="text-align:left">配置类型</td>
</tr>
</tbody>
</table>
<h3>返回参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">参数类型</th>
<th style="text-align:left">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">boolean</td>
<td style="text-align:left">是否发布成功</td>
</tr>
</tbody>
</table>
<h3>错误编码</h3>
<table>
<thead>
<tr>
<th style="text-align:left">错误代码</th>
<th style="text-align:left">描述</th>
<th style="text-align:left">语义</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">400</td>
<td style="text-align:left">Bad Request</td>
<td style="text-align:left">客户端请求中的语法错误</td>
</tr>
<tr>
<td style="text-align:left">403</td>
<td style="text-align:left">Forbidden</td>
<td style="text-align:left">没有权限</td>
</tr>
<tr>
<td style="text-align:left">404</td>
<td style="text-align:left">Not Found</td>
<td style="text-align:left">无法找到资源</td>
</tr>
<tr>
<td style="text-align:left">500</td>
<td style="text-align:left">Internal Server Error</td>
<td style="text-align:left">服务器内部错误</td>
</tr>
<tr>
<td style="text-align:left">200</td>
<td style="text-align:left">OK</td>
<td style="text-align:left">正常</td>
</tr>
</tbody>
</table>
<h3>示例</h3>
<ul>
<li>请求示例</li>
</ul>
<pre><code>http:serverIp:8848/nacos/v1/cs/configs

http body：
dataId=dataIdparam&amp;group=groupParam&amp;tenant=tenantParam&amp;content=contentParam&amp;type=typeParam

</code></pre>
<ul>
<li>返回示例</li>
</ul>
<pre><code>true
</code></pre>
<h2 id="1.4">删除配置</h2>
<h3>描述</h3>
<p>删除 Nacos 上的配置。</p>
<h3>请求类型</h3>
<p>DELETE</p>
<h3>请求 URL</h3>
<p>/nacos/v1/cs/configs</p>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必须</th>
<th style="text-align:left">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">tenant</td>
<td style="text-align:left">string</td>
<td style="text-align:left">否</td>
<td style="text-align:left">租户信息，对应 Naocs 的命名空间ID字段</td>
</tr>
<tr>
<td style="text-align:left">dataId</td>
<td style="text-align:left">string</td>
<td style="text-align:left">是</td>
<td style="text-align:left">配置 ID</td>
</tr>
<tr>
<td style="text-align:left">group</td>
<td style="text-align:left">string</td>
<td style="text-align:left">是</td>
<td style="text-align:left">配置分组</td>
</tr>
</tbody>
</table>
<h3>返回参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">参数类型</th>
<th style="text-align:left">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">boolean</td>
<td style="text-align:left">是否删除成功</td>
</tr>
</tbody>
</table>
<h3>错误编码</h3>
<table>
<thead>
<tr>
<th style="text-align:left">错误代码</th>
<th style="text-align:left">描述</th>
<th style="text-align:left">语义</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">400</td>
<td style="text-align:left">Bad Request</td>
<td style="text-align:left">客户端请求中的语法错误</td>
</tr>
<tr>
<td style="text-align:left">403</td>
<td style="text-align:left">Forbidden</td>
<td style="text-align:left">没有权限</td>
</tr>
<tr>
<td style="text-align:left">404</td>
<td style="text-align:left">Not Found</td>
<td style="text-align:left">无法找到资源</td>
</tr>
<tr>
<td style="text-align:left">500</td>
<td style="text-align:left">Internal Server Error</td>
<td style="text-align:left">服务器内部错误</td>
</tr>
<tr>
<td style="text-align:left">200</td>
<td style="text-align:left">OK</td>
<td style="text-align:left">正常</td>
</tr>
</tbody>
</table>
<h3>示例</h3>
<ul>
<li>请求示例</li>
</ul>
<pre><code>http:serverIp:8848/nacos/v1/cs/configs?dataId=dataIdparam&amp;group=groupParam

</code></pre>
<ul>
<li>返回示例</li>
</ul>
<pre><code>true
</code></pre>
<h2>服务发现</h2>
<h2 id="2.1">注册实例</h2>
<h3>描述</h3>
<p>注册一个实例到服务。</p>
<h3>请求类型</h3>
<p>POST</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/instance
</code></pre>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">ip</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务实例IP</td>
</tr>
<tr>
<td style="text-align:left">port</td>
<td style="text-align:left">int</td>
<td style="text-align:left">是</td>
<td>服务实例port</td>
</tr>
<tr>
<td style="text-align:left">namespaceId</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>命名空间ID</td>
</tr>
<tr>
<td style="text-align:left">weight</td>
<td style="text-align:left">double</td>
<td style="text-align:left">否</td>
<td>权重</td>
</tr>
<tr>
<td style="text-align:left">enabled</td>
<td style="text-align:left">boolean</td>
<td style="text-align:left">否</td>
<td>是否上线</td>
</tr>
<tr>
<td style="text-align:left">healthy</td>
<td style="text-align:left">boolean</td>
<td style="text-align:left">否</td>
<td>是否健康</td>
</tr>
<tr>
<td style="text-align:left">metadata</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>扩展信息</td>
</tr>
<tr>
<td style="text-align:left">clusterName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>集群名</td>
</tr>
<tr>
<td style="text-align:left">serviceName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务名</td>
</tr>
<tr>
<td style="text-align:left">groupName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>分组名</td>
</tr>
<tr>
<td style="text-align:left">ephemeral</td>
<td style="text-align:left">boolean</td>
<td style="text-align:left">否</td>
<td>是否临时实例</td>
</tr>
</tbody>
</table>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X POST 'http://127.0.0.1:8848/nacos/v1/ns/instance?port=8848&amp;healthy=true&amp;ip=11.11.11.11&amp;weight=1.0&amp;serviceName=nacos.test.3&amp;encoding=GBK&amp;namespaceId=n1''
</code></pre>
<h3>示例返回</h3>
<p>ok</p>
<h2 id="2.2">注销实例</h2>
<h3>描述</h3>
<p>删除服务下的一个实例。</p>
<h3>请求类型</h3>
<p>DELETE</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/instance
</code></pre>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">serviceName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务名</td>
</tr>
<tr>
<td style="text-align:left">groupName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>分组名</td>
</tr>
<tr>
<td style="text-align:left">ip</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务实例IP</td>
</tr>
<tr>
<td style="text-align:left">port</td>
<td style="text-align:left">int</td>
<td style="text-align:left">是</td>
<td>服务实例port</td>
</tr>
<tr>
<td style="text-align:left">clusterName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>集群名称</td>
</tr>
<tr>
<td style="text-align:left">namespaceId</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>命名空间ID</td>
</tr>
<tr>
<td style="text-align:left">ephemeral</td>
<td style="text-align:left">boolean</td>
<td style="text-align:left">否</td>
<td>是否临时实例</td>
</tr>
</tbody>
</table>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X DELETE 127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.test.1&amp;ip=1.1.1.1&amp;port=8888&amp;clusterName=TEST1
</code></pre>
<h3>示例返回</h3>
<p>ok</p>
<h2 id="2.3">修改实例</h2>
<h3>描述</h3>
<p>修改服务下的一个实例。</p>
<h3>请求类型</h3>
<p>PUT</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/instance
</code></pre>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">serviceName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务名</td>
</tr>
<tr>
<td style="text-align:left">groupName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>分组名</td>
</tr>
<tr>
<td style="text-align:left">ip</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务实例IP</td>
</tr>
<tr>
<td style="text-align:left">port</td>
<td style="text-align:left">int</td>
<td style="text-align:left">是</td>
<td>服务实例port</td>
</tr>
<tr>
<td style="text-align:left">clusterName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>集群名称</td>
</tr>
<tr>
<td style="text-align:left">namespaceId</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>命名空间ID</td>
</tr>
<tr>
<td style="text-align:left">weight</td>
<td style="text-align:left">double</td>
<td style="text-align:left">否</td>
<td>权重</td>
</tr>
<tr>
<td style="text-align:left">metadata</td>
<td style="text-align:left">JSON</td>
<td style="text-align:left">否</td>
<td>扩展信息</td>
</tr>
<tr>
<td style="text-align:left">enabled</td>
<td style="text-align:left">boolean</td>
<td style="text-align:left">否</td>
<td>是否打开流量</td>
</tr>
<tr>
<td style="text-align:left">ephemeral</td>
<td style="text-align:left">boolean</td>
<td style="text-align:left">否</td>
<td>是否临时实例</td>
</tr>
</tbody>
</table>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X PUT 127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.test.1&amp;ip=1.1.1.1&amp;port=8888&amp;clusterName=TEST1&amp;weight=8&amp;metadata={}
</code></pre>
<h3>示例返回</h3>
<p>ok</p>
<h2 id="2.4">查询实例列表</h2>
<h3>描述</h3>
<p>查询服务下的实例列表</p>
<h3>请求类型</h3>
<p>GET</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/instance/list
</code></pre>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">serviceName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务名</td>
</tr>
<tr>
<td style="text-align:left">groupName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>分组名</td>
</tr>
<tr>
<td style="text-align:left">namespaceId</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>命名空间ID</td>
</tr>
<tr>
<td style="text-align:left">clusters</td>
<td style="text-align:left">字符串，多个集群用逗号分隔</td>
<td style="text-align:left">否</td>
<td>集群名称</td>
</tr>
<tr>
<td style="text-align:left">healthyOnly</td>
<td style="text-align:left">boolean</td>
<td style="text-align:left">否，默认为false</td>
<td>是否只返回健康实例</td>
</tr>
</tbody>
</table>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X GET 127.0.0.1:8848/nacos/v1/ns/instance/list?serviceName=nacos.test.1
</code></pre>
<h3>示例返回</h3>
<pre><code class="language-json">{
	<span class="hljs-attr">"dom"</span>: <span class="hljs-string">"nacos.test.1"</span>,
	<span class="hljs-attr">"cacheMillis"</span>: <span class="hljs-number">1000</span>,
	<span class="hljs-attr">"useSpecifiedURL"</span>: <span class="hljs-literal">false</span>,
	<span class="hljs-attr">"hosts"</span>: [{
		<span class="hljs-attr">"valid"</span>: <span class="hljs-literal">true</span>,
		<span class="hljs-attr">"marked"</span>: <span class="hljs-literal">false</span>,
		<span class="hljs-attr">"instanceId"</span>: <span class="hljs-string">"10.10.10.10-8888-DEFAULT-nacos.test.1"</span>,
		<span class="hljs-attr">"port"</span>: <span class="hljs-number">8888</span>,
		<span class="hljs-attr">"ip"</span>: <span class="hljs-string">"10.10.10.10"</span>,
		<span class="hljs-attr">"weight"</span>: <span class="hljs-number">1.0</span>,
		<span class="hljs-attr">"metadata"</span>: {}
	}],
	<span class="hljs-attr">"checksum"</span>: <span class="hljs-string">"3bbcf6dd1175203a8afdade0e77a27cd1528787794594"</span>,
	<span class="hljs-attr">"lastRefTime"</span>: <span class="hljs-number">1528787794594</span>,
	<span class="hljs-attr">"env"</span>: <span class="hljs-string">""</span>,
	<span class="hljs-attr">"clusters"</span>: <span class="hljs-string">""</span>
}
</code></pre>
<h2 id="2.5">查询实例详情</h2>
<h3>描述</h3>
<p>查询一个服务下个某个实例详情。</p>
<h3>请求类型</h3>
<p>GET</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/instance
</code></pre>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">serviceName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务名</td>
</tr>
<tr>
<td style="text-align:left">groupName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>分组名</td>
</tr>
<tr>
<td style="text-align:left">ip</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>实例IP</td>
</tr>
<tr>
<td style="text-align:left">port</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>实例端口</td>
</tr>
<tr>
<td style="text-align:left">namespaceId</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>命名空间ID</td>
</tr>
<tr>
<td style="text-align:left">cluster</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>集群名称</td>
</tr>
<tr>
<td style="text-align:left">healthyOnly</td>
<td style="text-align:left">boolean</td>
<td style="text-align:left">否，默认为false</td>
<td>是否只返回健康实例</td>
</tr>
<tr>
<td style="text-align:left">ephemeral</td>
<td style="text-align:left">boolean</td>
<td style="text-align:left">否</td>
<td>是否临时实例</td>
</tr>
</tbody>
</table>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X GET '127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.test.2&amp;ip=10.10.10.10&amp;port=8888&amp;cluster=DEFAULT'
</code></pre>
<h3>示例返回</h3>
<pre><code class="language-json">{
	<span class="hljs-attr">"metadata"</span>: {},
	<span class="hljs-attr">"instanceId"</span>: <span class="hljs-string">"10.10.10.10-8888-DEFAULT-nacos.test.2"</span>,
	<span class="hljs-attr">"port"</span>: <span class="hljs-number">8888</span>,
	<span class="hljs-attr">"service"</span>: <span class="hljs-string">"nacos.test.2"</span>,
	<span class="hljs-attr">"healthy"</span>: <span class="hljs-literal">false</span>,
	<span class="hljs-attr">"ip"</span>: <span class="hljs-string">"10.10.10.10"</span>,
	<span class="hljs-attr">"clusterName"</span>: <span class="hljs-string">"DEFAULT"</span>,
	<span class="hljs-attr">"weight"</span>: <span class="hljs-number">1.0</span>
}
</code></pre>
<h2 id="2.6">发送实例心跳</h2>
<h3>描述</h3>
<p>发送某个实例的心跳</p>
<h3>请求类型</h3>
<p>PUT</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/instance/beat
</code></pre>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">serviceName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务名</td>
</tr>
<tr>
<td style="text-align:left">groupName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>分组名</td>
</tr>
<tr>
<td style="text-align:left">ephemeral</td>
<td style="text-align:left">boolean</td>
<td style="text-align:left">否</td>
<td>是否临时实例</td>
</tr>
<tr>
<td style="text-align:left">beat</td>
<td style="text-align:left">JSON格式字符串</td>
<td style="text-align:left">是</td>
<td>实例心跳内容</td>
</tr>
</tbody>
</table>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X PUT '127.0.0.1:8848/nacos/v1/ns/instance/beat?serviceName=nacos.test.2&amp;beat=%7b%22cluster%22%3a%22c1%22%2c%22ip%22%3a%22127.0.0.1%22%2c%22metadata%22%3a%7b%7d%2c%22port%22%3a8080%2c%22scheduled%22%3atrue%2c%22serviceName%22%3a%22jinhan0Fx4s.173TL.net%22%2c%22weight%22%3a1%7d'
</code></pre>
<h3>示例返回</h3>
<pre><code>ok
</code></pre>
<h2 id="2.7">创建服务</h2>
<h3>描述</h3>
<p>创建一个服务</p>
<h3>请求类型</h3>
<p>POST</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/service
</code></pre>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">serviceName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务名</td>
</tr>
<tr>
<td style="text-align:left">groupName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>分组名</td>
</tr>
<tr>
<td style="text-align:left">namespaceId</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>命名空间ID</td>
</tr>
<tr>
<td style="text-align:left">protectThreshold</td>
<td style="text-align:left">浮点数</td>
<td style="text-align:left">否</td>
<td>保护阈值,取值0到1,默认0</td>
</tr>
<tr>
<td style="text-align:left">metadata</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>元数据</td>
</tr>
<tr>
<td style="text-align:left">selector</td>
<td style="text-align:left">JSON格式字符串</td>
<td style="text-align:left">否</td>
<td>访问策略</td>
</tr>
</tbody>
</table>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X POST '127.0.0.1:8848/nacos/v1/ns/service?serviceName=nacos.test.2&amp;metadata=k1%3dv1'
</code></pre>
<h3>示例返回</h3>
<pre><code>ok
</code></pre>
<h2 id="2.8">删除服务</h2>
<h3>描述</h3>
<p>删除一个服务,只有当服务下实例数为0时允许删除</p>
<h3>请求类型</h3>
<p>DELETE</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/service
</code></pre>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">serviceName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务名</td>
</tr>
<tr>
<td style="text-align:left">groupName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>分组名</td>
</tr>
<tr>
<td style="text-align:left">namespaceId</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>命名空间ID</td>
</tr>
</tbody>
</table>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X DELETE '127.0.0.1:8848/nacos/v1/ns/service?serviceName=nacos.test.2'
</code></pre>
<h3>示例返回</h3>
<pre><code>ok
</code></pre>
<h2 id="2.9">修改服务</h2>
<h3>描述</h3>
<p>更新一个服务</p>
<h3>请求类型</h3>
<p>PUT</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/service
</code></pre>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">serviceName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务名</td>
</tr>
<tr>
<td style="text-align:left">groupName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>分组名</td>
</tr>
<tr>
<td style="text-align:left">namespaceId</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>命名空间ID</td>
</tr>
<tr>
<td style="text-align:left">protectThreshold</td>
<td style="text-align:left">浮点数</td>
<td style="text-align:left">否</td>
<td>保护阈值,取值0到1,默认0</td>
</tr>
<tr>
<td style="text-align:left">metadata</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>元数据</td>
</tr>
<tr>
<td style="text-align:left">selector</td>
<td style="text-align:left">JSON格式字符串</td>
<td style="text-align:left">否</td>
<td>访问策略</td>
</tr>
</tbody>
</table>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X PUT '127.0.0.1:8848/nacos/v1/ns/service?serviceName=nacos.test.2&amp;metadata=k1%3dv1'
</code></pre>
<h3>示例返回</h3>
<pre><code>ok
</code></pre>
<h2 id="2.10">查询服务</h2>
<h3>描述</h3>
<p>查询一个服务</p>
<h3>请求类型</h3>
<p>GET</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/service
</code></pre>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">serviceName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务名</td>
</tr>
<tr>
<td style="text-align:left">groupName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>分组名</td>
</tr>
<tr>
<td style="text-align:left">namespaceId</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>命名空间ID</td>
</tr>
</tbody>
</table>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X GET '127.0.0.1:8848/nacos/v1/ns/service?serviceName=nacos.test.2'
</code></pre>
<h3>示例返回</h3>
<pre><code>{
    metadata: { },
    groupName: &quot;DEFAULT_GROUP&quot;,
    namespaceId: &quot;public&quot;,
    name: &quot;nacos.test.2&quot;,
    selector: {
        type: &quot;none&quot;
    },
    protectThreshold: 0,
    clusters: [
        {
            healthChecker: {
                type: &quot;TCP&quot;
            },
            metadata: { },
            name: &quot;c1&quot;
        }
    ]
}
</code></pre>
<h2 id="2.11">查询服务列表</h2>
<h3>描述</h3>
<p>查询服务列表</p>
<h3>请求类型</h3>
<p>GET</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/service/list
</code></pre>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">pageNo</td>
<td style="text-align:left">int</td>
<td style="text-align:left">是</td>
<td>当前页码</td>
</tr>
<tr>
<td style="text-align:left">pageSize</td>
<td style="text-align:left">int</td>
<td style="text-align:left">是</td>
<td>分页大小</td>
</tr>
<tr>
<td style="text-align:left">groupName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>分组名</td>
</tr>
<tr>
<td style="text-align:left">namespaceId</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>命名空间ID</td>
</tr>
</tbody>
</table>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X GET '127.0.0.1:8848/nacos/v1/ns/service/list?pageNo=1&amp;pageSize=2'
</code></pre>
<h3>示例返回</h3>
<pre><code>{
    &quot;count&quot;:148,
    &quot;doms&quot;: [
        &quot;nacos.test.1&quot;,
        &quot;nacos.test.2&quot;
    ]
}
</code></pre>
<h2 id="2.12">查询系统开关</h2>
<h3>描述</h3>
<p>查询系统开关</p>
<h3>请求类型</h3>
<p>GET</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/operator/switches
</code></pre>
<h3>请求参数</h3>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X GET '127.0.0.1:8848/nacos/v1/ns/operator/switches'
</code></pre>
<h3>示例返回</h3>
<pre><code>{
    name: &quot;00-00---000-NACOS_SWITCH_DOMAIN-000---00-00&quot;,
    masters: null,
    adWeightMap: { },
    defaultPushCacheMillis: 10000,
    clientBeatInterval: 5000,
    defaultCacheMillis: 3000,
    distroThreshold: 0.7,
    healthCheckEnabled: true,
    distroEnabled: true,
    enableStandalone: true,
    pushEnabled: true,
    checkTimes: 3,
    httpHealthParams: {
        max: 5000,
        min: 500,
        factor: 0.85
    },
    tcpHealthParams: {
        max: 5000,
        min: 1000,
        factor: 0.75
    },
    mysqlHealthParams: {
        max: 3000,
        min: 2000,
        factor: 0.65
    },
    incrementalList: [ ],
    serverStatusSynchronizationPeriodMillis: 15000,
    serviceStatusSynchronizationPeriodMillis: 5000,
    disableAddIP: false,
    sendBeatOnly: false,
    limitedUrlMap: { },
    distroServerExpiredMillis: 30000,
    pushGoVersion: &quot;0.1.0&quot;,
    pushJavaVersion: &quot;0.1.0&quot;,
    pushPythonVersion: &quot;0.4.3&quot;,
    pushCVersion: &quot;1.0.12&quot;,
    enableAuthentication: false,
    overriddenServerStatus: &quot;UP&quot;,
    defaultInstanceEphemeral: true,
    healthCheckWhiteList: [ ],
    checksum: null
}
</code></pre>
<h2 id="2.13">修改系统开关</h2>
<h3>描述</h3>
<p>修改系统开关</p>
<h3>请求类型</h3>
<p>PUT</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/operator/switches
</code></pre>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">entry</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>开关名</td>
</tr>
<tr>
<td style="text-align:left">value</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>开关值</td>
</tr>
<tr>
<td style="text-align:left">debug</td>
<td style="text-align:left">boolean</td>
<td style="text-align:left">否</td>
<td>是否只在本机生效,true表示本机生效,false表示集群生效</td>
</tr>
</tbody>
</table>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X PUT '127.0.0.1:8848/nacos/v1/ns/operator/switches?entry=pushEnabled&amp;value=false&amp;debug=true'
</code></pre>
<h3>示例返回</h3>
<pre><code>ok
</code></pre>
<h2 id="2.14">查看系统当前数据指标</h2>
<h3>描述</h3>
<p>查看系统当前数据指标</p>
<h3>请求类型</h3>
<p>GET</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/operator/metrics
</code></pre>
<h3>请求参数</h3>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X GET '127.0.0.1:8848/nacos/v1/ns/operator/metrics'
</code></pre>
<h3>示例返回</h3>
<pre><code>{
    serviceCount: 336,
    load: 0.09,
    mem: 0.46210432,
    responsibleServiceCount: 98,
    instanceCount: 4,
    cpu: 0.010242796,
    status: &quot;UP&quot;,
    responsibleInstanceCount: 0
}
</code></pre>
<h2 id="2.15">查看当前集群Server列表</h2>
<h3>描述</h3>
<p>查看当前集群Server列表</p>
<h3>请求类型</h3>
<p>GET</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/operator/servers
</code></pre>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">healthy</td>
<td style="text-align:left">boolean</td>
<td style="text-align:left">否</td>
<td>是否只返回健康Server节点</td>
</tr>
</tbody>
</table>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X GET '127.0.0.1:8848/nacos/v1/ns/operator/servers'
</code></pre>
<h3>示例返回</h3>
<pre><code>{
    servers: [
        {
            ip: &quot;1.1.1.1&quot;,
            servePort: 8848,
            site: &quot;unknown&quot;,
            weight: 1,
            adWeight: 0,
            alive: false,
            lastRefTime: 0,
            lastRefTimeStr: null,
            key: &quot;1.1.1.1:8848&quot;
        },
        {
            ip: &quot;1.1.1.2&quot;,
            servePort: 8848,
            site: &quot;unknown&quot;,
            weight: 1,
            adWeight: 0,
            alive: false,
            lastRefTime: 0,
            lastRefTimeStr: null,
            key: &quot;1.1.1.2:8848&quot;
        },
        {
            ip: &quot;1.1.1.3&quot;,
            servePort: 8848,
            site: &quot;unknown&quot;,
            weight: 1,
            adWeight: 0,
            alive: false,
            lastRefTime: 0,
            lastRefTimeStr: null,
            key: &quot;1.1.1.3:8848&quot;
        }
    ]
}
</code></pre>
<h2 id="2.16">查看当前集群leader</h2>
<h3>描述</h3>
<p>查看当前集群leader</p>
<h3>请求类型</h3>
<p>GET</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/raft/leader
</code></pre>
<h3>请求参数</h3>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X GET '127.0.0.1:8848/nacos/v1/ns/raft/leader'
</code></pre>
<h3>示例返回</h3>
<pre><code>{
    leader: &quot;{&quot;heartbeatDueMs&quot;:2500,&quot;ip&quot;:&quot;1.1.1.1:8848&quot;,&quot;leaderDueMs&quot;:12853,&quot;state&quot;:&quot;LEADER&quot;,&quot;term&quot;:54202,&quot;voteFor&quot;:&quot;1.1.1.1:8848&quot;}&quot;
}
</code></pre>
<h2 id="2.17">更新实例的健康状态</h2>
<h3>描述</h3>
<p>更新实例的健康状态,仅在集群的健康检查关闭时才生效,当集群配置了健康检查时,该接口会返回错误</p>
<h3>请求类型</h3>
<p>PUT</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/health/instance
</code></pre>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">namespaceId</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>命名空间ID</td>
</tr>
<tr>
<td style="text-align:left">serviceName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务名</td>
</tr>
<tr>
<td style="text-align:left">groupName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>分组名</td>
</tr>
<tr>
<td style="text-align:left">clusterName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>集群名</td>
</tr>
<tr>
<td style="text-align:left">ip</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务实例IP</td>
</tr>
<tr>
<td style="text-align:left">port</td>
<td style="text-align:left">int</td>
<td style="text-align:left">是</td>
<td>服务实例port</td>
</tr>
<tr>
<td style="text-align:left">healthy</td>
<td style="text-align:left">boolean</td>
<td style="text-align:left">是</td>
<td>是否健康</td>
</tr>
</tbody>
</table>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X PUT 'http://127.0.0.1:8848/nacos/v1/ns/health/instance?port=8848&amp;healthy=true&amp;ip=11.11.11.11&amp;serviceName=nacos.test.3&amp;namespaceId=n1''
</code></pre>
<h3>示例返回</h3>
<p>ok</p>
<h2 id="2.18">批量更新实例元数据(Beta)</h2>
<h3>描述</h3>
<p>批量更新实例元数据(1.4起)</p>
<blockquote>
<p>注意：该接口为Beta接口，后续版本可能有所修改，甚至删除，请谨慎使用。</p>
</blockquote>
<h3>请求类型</h3>
<p>PUT</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/instance/metadata/batch
</code></pre>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">namespaceId</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>命名空间ID</td>
</tr>
<tr>
<td style="text-align:left">serviceName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务名(group@@serviceName)</td>
</tr>
<tr>
<td style="text-align:left">consistencyType</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>实例的类型(ephemeral/persist)</td>
</tr>
<tr>
<td style="text-align:left">instances</td>
<td style="text-align:left">JSON格式字符串</td>
<td style="text-align:left">否</td>
<td>需要更新的实例</td>
</tr>
<tr>
<td style="text-align:left">metadata</td>
<td style="text-align:left">JSON格式字符串</td>
<td style="text-align:left">是</td>
<td>元数据信息</td>
</tr>
</tbody>
</table>
<h3>参数说明</h3>
<ul>
<li>consistencyType: 优先级高于instances参数，如果进行配置，则忽略instances参数的值。当值为'ephemeral'，则对serviceName下的所有非持久化实例进行更新。当值为'persist'，则对serviceName下的所有持久化实例进行更新。当为其他值，没有实例进行更新。</li>
<li>instances: json数组。通过ip+port+ephemeral+cluster定位到某一实例。</li>
</ul>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X PUT 'http://localhost:8848/nacos/v1/ns/instance/metadata/batch' -d 'namespaceId=public&amp;serviceName=xxxx@@xxxx&amp;instances=[{&quot;ip&quot;:&quot;3.3.3.3&quot;,&quot;port&quot;: &quot;8080&quot;,&quot;ephemeral&quot;:&quot;true&quot;,&quot;clusterName&quot;:&quot;xxxx-cluster&quot;},{&quot;ip&quot;:&quot;2.2.2.2&quot;,&quot;port&quot;:&quot;8080&quot;,&quot;ephemeral&quot;:&quot;true&quot;,&quot;clusterName&quot;:&quot;xxxx-cluster&quot;}]&amp;metadata={&quot;age&quot;:&quot;20&quot;,&quot;name&quot;:&quot;cocolan&quot;}' 
or
curl -X PUT 'http://localhost:8848/nacos/v1/ns/instance/metadata/batch' -d 'namespaceId=public&amp;serviceName=xxxx@@xxxx&amp;consistencyType=ephemeral&amp;metadata={&quot;age&quot;:&quot;20&quot;,&quot;name&quot;:&quot;cocolan&quot;}'
</code></pre>
<h3>示例返回</h3>
<pre><code>{&quot;updated&quot;:[&quot;2.2.2.2:8080:unknown:xxxx-cluster:ephemeral&quot;,&quot;3.3.3.3:8080:unknown:xxxx-cluster:ephemeral&quot;]}
</code></pre>
<h2 id="2.19">批量删除实例元数据(Beta)</h2>
<h3>描述</h3>
<p>批量删除实例元数据(1.4起)</p>
<blockquote>
<p>注意：该接口为Beta接口，后续版本可能有所修改，甚至删除，请谨慎使用。</p>
</blockquote>
<h3>请求类型</h3>
<p>DELETE</p>
<h3>请求路径</h3>
<pre><code class="language-plain">/nacos/v1/ns/instance/metadata/batch
</code></pre>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th style="text-align:left">名称</th>
<th style="text-align:left">类型</th>
<th style="text-align:left">是否必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">namespaceId</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>命名空间ID</td>
</tr>
<tr>
<td style="text-align:left">serviceName</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">是</td>
<td>服务名(group@@serviceName)</td>
</tr>
<tr>
<td style="text-align:left">consistencyType</td>
<td style="text-align:left">字符串</td>
<td style="text-align:left">否</td>
<td>实例的类型(ephemeral/persist)</td>
</tr>
<tr>
<td style="text-align:left">instances</td>
<td style="text-align:left">JSON格式字符串</td>
<td style="text-align:left">否</td>
<td>需要更新的实例</td>
</tr>
<tr>
<td style="text-align:left">metadata</td>
<td style="text-align:left">JSON格式字符串</td>
<td style="text-align:left">是</td>
<td>元数据信息</td>
</tr>
</tbody>
</table>
<h3>参数说明</h3>
<ul>
<li>consistencyType: 优先级高于instances参数，如果进行配置，则忽略instances参数的值。当值为ephemeral，则对serviceName下的所有非持久化实例进行更新。当值为persist，则对serviceName下的所有持久化实例进行更新。当为其他值，没有实例进行更新。</li>
<li>instances: json数组。通过ip+port+ephemeral+cluster定位到某一实例。</li>
</ul>
<h3>示例请求</h3>
<pre><code class="language-plain">curl -X DELETE 'http://localhost:8848/nacos/v1/ns/instance/metadata/batch' -d 'namespaceId=public&amp;serviceName=xxxx@@xxxx&amp;instances=[{&quot;ip&quot;:&quot;3.3.3.3&quot;,&quot;port&quot;: &quot;8080&quot;,&quot;ephemeral&quot;:&quot;true&quot;,&quot;clusterName&quot;:&quot;xxxx-cluster&quot;},{&quot;ip&quot;:&quot;2.2.2.2&quot;,&quot;port&quot;:&quot;8080&quot;,&quot;ephemeral&quot;:&quot;true&quot;,&quot;clusterName&quot;:&quot;xxxx-cluster&quot;}]&amp;metadata={&quot;age&quot;:&quot;20&quot;,&quot;name&quot;:&quot;cocolan&quot;}' 
or
curl -X DELETE 'http://localhost:8848/nacos/v1/ns/instance/metadata/batch' -d 'namespaceId=public&amp;serviceName=xxxx@@xxxx&amp;consistencyType=ephemeral&amp;metadata={&quot;age&quot;:&quot;20&quot;,&quot;name&quot;:&quot;cocolan&quot;}'
</code></pre>
<h3>示例返回</h3>
<pre><code>{&quot;updated&quot;:[&quot;2.2.2.2:8080:unknown:xxxx-cluster:ephemeral&quot;,&quot;3.3.3.3:8080:unknown:xxxx-cluster:ephemeral&quot;]}
</code></pre>
</div></div></section><footer class="footer-container"><div class="footer-body"><img src="/img/nacos_gray.png"/><div class="cols-container"><div class="col col-12"><h3>愿景</h3><p>Nacos 通过提供简单易用的动态服务发现、服务配置、服务共享与管理等服务基础设施，帮助用户在云原生时代，在私有云、混合云或者公有云等所有云环境中，更好的构建、交付、管理自己的微服务平台，更快的复用和组合业务服务，更快的交付商业创新的价值，从而为用户赢得市场。</p></div><div class="col col-6"><dl><dt>文档</dt><dd><a href="/zh-cn/docs/what-is-nacos.html" target="_self">概览</a></dd><dd><a href="/zh-cn/docs/quick-start.html" target="_self">快速开始</a></dd><dd><a href="/zh-cn/docs/contributing.html" target="_self">开发者指南</a></dd></dl></div><div class="col col-6"><dl><dt>资源</dt><dd><a href="/zh-cn/community/index.html" target="_self">社区</a></dd><dd><a href="https://www.aliyun.com/product/acm?source_type=nacos_pc_20181219" target="_self">云服务 ACM</a></dd><dd><a href="https://www.aliyun.com/product/edas?source_type=nacos_pc_20181219" target="_self">云服务 EDAS</a></dd><dd><a href="https://www.aliyun.com/product/ahas?source_type=nacos_pc_20190225" target="_self">云服务 AHAS</a></dd></dl></div></div><div class="copyright"><span>@ 2018 The Nacos Authors | An Alibaba Middleware (Aliware) Project</span></div></div></footer></div></div>
	<script src="https://f.alicdn.com/react/15.4.1/react-with-addons.min.js"></script>
	<script src="https://f.alicdn.com/react/15.4.1/react-dom.min.js"></script>
	<script>
		window.rootPath = '';
  </script>
	<script src="/build/documentation.js"></script>
</body>
</html>